package com.seal.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.seal.comm.utils.Page;
import com.seal.dao.IOrderInfoDao;
import com.seal.dto.OrderInfoDto;
import com.seal.model.OrderInfo;
import com.seal.model.UserInfo;
import com.seal.service.IOrderInfoService;

@Service("orderInfoServiceImpl")
@Transactional(readOnly = true)
public class OrderInfoServiceImpl implements IOrderInfoService {
	
	@Resource(name="orderInfoDaoImpl")
	private IOrderInfoDao orderInfoDao;

	public OrderInfo getOrderInfoById(Long id) throws Exception {
		return orderInfoDao.getOrderInfoById(id);
	}

	@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
	public void savaOrUpdateOrderInfo(OrderInfo info) throws Exception {
		orderInfoDao.savaOrUpdateOrderInfo(info);
	}
	
	@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
	public void saveOrderInfo(OrderInfo info) throws Exception {
		orderInfoDao.saveOrderInfo(info);
	}

	@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
	public void updateOrderInfo(OrderInfo info) throws Exception {
		orderInfoDao.updateOrderInfo(info);
	}

	public List<OrderInfo> getOrderInfoByUserId(UserInfo userInfo)
			throws Exception {
		return orderInfoDao.getOrderInfoByUserId(userInfo);
	}

	public List<OrderInfo> getOrderInfoList(OrderInfoDto dto, Page page)
			throws Exception {
		return orderInfoDao.getOrderInfoList(dto, page);
	}

}
